package com.cyp.blogsystem.mapper;

import com.cyp.blogsystem.pojo.Like;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface LikeMapper {
    /**
     * 插入点赞记录
     */
    int insert(Like like);

    /**
     * 删除点赞记录
     */
    int delete(Long userId, Long articleId);

    /**
     * 查询点赞记录
     */
    Like selectByUserIdAndArticleId(Long userId, Long articleId);

    /**
     * 统计文章点赞数
     */
    long countByArticleId(Long articleId);

    /**
     * 根据文章ID删除点赞记录
     */
    int deleteByArticleId(Long articleId);

    /**
     * 根据用户ID删除点赞记录
     */
    int deleteByUserId(Long userId);

    /**
     * 根据ID删除点赞记录
     */
    int deleteById(Long id);
}